<?php
/* @var $this IncomeController */
/* @var $model Income */
/* @var $form CActiveForm */
?>
<div class="widget-box">
    <div class="widget-title">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#tab1">Income</a></li>
            <li class=""><a data-toggle="tab" href="#tab2">Profile</a></li>
        </ul>
    </div>
    <div class="widget-content tab-content">
        <div id="tab1" class="tab-pane active">
            <div class="widget-content nopadding">
                <?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
                    'id'=>'income-form',
                    'enableAjaxValidation'=>false,
                    'type' => 'horizontal',
                    'inlineErrors' => true
                )); ?>
                <?php
                echo $form->textFieldRow($model, 'name');
                echo $form->dropDownListRow($model, 'cat_id', CHtml::listData(Danhmuc::model()->findAll('type = 1 and parent_id IS NULL'), 'id', 'name'),
                    array(
                        'prompt' => 'Chọn danh mục chính',
                        'ajax' => array(
                            'type' => 'POST',
                            'url' => Yii::app()->createAbsoluteUrl('spend/DynamicCategories'),
                            'update' => '#Income_sub_cat_id',
                            'data' => array('cat_id' => 'js:this.value'),
                        ),
                    )
                );
                echo $form->dropDownListRow($model, 'sub_cat_id', CHtml::listData(Danhmuc::model()->findAll('type = 3'), 'id', 'name'),
                    array(
                        'prompt' => 'Chọn danh mục phụ',
                    )
                );
                echo $form->textFieldRow($model, 'note');
                ?>
                <div class="control-group">
                    <?php
                    echo $form->labelEx($model, 'time', array('class' => 'control-label'));
                    ?>
                    <div class="controls">
                        <?php  $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                            'name' => 'time',
                            'value' => $time,
                            'options' => array(
                                'showAnim' => 'fold',
                                'constrainInput' => 'true',
                            ),
                            'htmlOptions' => array(
                                'style' => 'height:20px;'
                            ),
                        )); ?>
                    </div>
                </div>
                <?php
                echo $form->textFieldRow($model, 'reference');
                echo $form->textFieldRow($model, 'value');
                ?>
                <div class="form-actions">
                    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Thêm mới', 'htmlOptions' => array('name' => 'submit'))); ?>
                </div>
            </div>
        </div>
        <div id="tab2" class="tab-pane">
            This is a Tab Two Content
        </div>
    </div>
</div>

<?php $this->endWidget(); ?>

</div><!-- form -->